Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


Opening An Interface

The USBNewInterfaceRef function performs the first step in opening an interface. The USBConfigureInterface function completes the process by setting up the interface for further communication.

USBNewInterfaceRef

The USBNewInterfaceRef function generates a new reference number that allows the interface in the specified device to be referred to. The interface reference can be used in most circumstances where a device reference can be used. An interface reference is required to be passed to the function USBExpertInstallInterfaceDriver .

OSStatus USBNewInterfaceRef(USBPB *pb);

Required fields in the USBPB parameter block for the USBNewInterfaceRef function are

--> pbLength
Length of parameter block
--> pbVersion
Parameter block version number
--> usbCompletion
The completion routine
--> usbRefcon
General-purpose value passed back to the completion routine
<--> usbReference
--> Device reference of device being configured <-- Interface reference returned
-- usbBuffer
Should be set to 0 (0 returned); reserved in this call
-- usbActCount
Should be set to 0 (0 returned); reserved in this call
-- usbReqCount
Should be set to 0 (0 returned); reserved in this call
--> usbWIndex
Interface number
--> usbFlags
Should be set to 0

If you create an interface reference, the interface reference must be disposed of in the driver finalize routine.

Errors returned by the USBNewInterfaceRef function include

paramErr usbBuffer pointer, usbReqCount, or usbActCount fields are not set to 0
kUSBUnknownDeviceErr -6998 usbReference does not refer to a current device
kUSBDeviceBusy -6977 the device is already being configured
kUSBNotFound -6987 interface or configuration specified is not in configuration descriptor
kUSBOutOfMemoryErr -6988 ran our of internal structures

© 1998 Apple Computer, Inc. – (Last Updated 23 Nov 98)

Previous | Back Up One Level | Next |